import request from "@/utils/request";

// 加入购物车
export const addGoodsApi = (gameId: any) => {
  return request({
    url: "/cart",
    method: "post",
    data: gameId,
  });
};

// 修改商品数量
export const changeGoodsNumApi = (goods: any) => {
  return request({
    url: "/cart",
    method: "post",
    data: goods,
  });
};

// 删除商品
export const removeGoodsApi = (gameId: any) => {
  return request({
    url: "/cart",
    method: "delete",
    data: gameId,
  });
};

// 获取购物车列表
export const getCartListApi = () => {
  return request({
    url: "/cart",
    method: "get",
  });
};

// 清空购物车
export const clearGoodsApi = () => {
  return request({
    url: "/cart/clear",
    method: "delete",
  });
};
